﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Loong.Net;
using System.Threading;
using GoogleCode.FacebookCSharp.Utilities;

namespace Test
{
    class Program
    {
        static void Main1(string[] args)
        {
           
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            sw.Start();
            for (int i = 0; i < 1000; i++)
            {

                HTTPWorker worker = new HTTPWorker();
                worker.SetTarget("http://translate.google.cn/translate_t#", HTTPRequestType.Post);
                worker.AddValue("sl", "en");
                worker.AddValue("tl", "v");
                worker.AddValue("hl", "zh-CN");
                worker.AddValue("text", "After being accused for weeks of being too negative about the economy, Obama recently has shifted to a more positive tone. He and his aides still say recovery won't come quickly, but they are becoming more aggressive in declaring that the government's efforts will work.");
                worker.SendRequest();
                Console.WriteLine(i);
            }
            //Console.Write(worker.ResponseText);
            Console.WriteLine(string.Format("花费时间：{0}毫秒<br/>", sw.ElapsedMilliseconds));


           //System.Diagnostics.Stopwatch sw1 = new System.Diagnostics.Stopwatch();

           //sw1.Start();
           //for (int i = 0; i < 1000; i++)
           //{
           //    HttpClient worker1 = new HttpClient("http://translate.google.cn/translate_t#", HTTPMethod.Post);
           //    worker1.AddPostData("sl", "en");
           //    worker1.AddPostData("tl", "v");
           //    worker1.AddPostData("hl", "zh-CN");
           //    worker1.AddPostData("text", "After being accused for weeks of being too negative about the economy, Obama recently has shifted to a more positive tone. He and his aides still say recovery won't come quickly, but they are becoming more aggressive in declaring that the government's efforts will work.");
           //    worker1.SendRequest();
           //    Thread.Sleep(1000);
           //    //Console.Write(worker.ResponseText);
           //}
           //HttpClient client = new HttpClient("http://translate.google.cn/translate_t#", HTTPMethod.Post);
           //client.AddPostData("sl", "en");
           //client.AddPostData("tl", "v");
           //client.AddPostData("hl", "zh-CN");
           //client.AddPostData("text", "After being accused for weeks of being too negative about the economy, Obama recently has shifted to a more positive tone. He and his aides still say recovery won't come quickly, but they are becoming more aggressive in declaring that the government's efforts will work.");
           //client.SendRequest();
           //Console.Write(client.ResponseText);


           // Console.WriteLine(string.Format("花费时间：{0}毫秒<br/>", sw1.ElapsedMilliseconds));
            Console.Read();

        }


    }
}
